package com.hgw.Demo01_ChainOfResponsibilityPattern.examples;

/**
 * Data time:2021/12/16 12:55
 * StudentID:2019112118
 * Author:hgw
 * Description: 客户端测试类
 */
public class Client {
    public static void main(String[] args) {
        Approver wjzhang,gyang,jguo,meeting;
        wjzhang = new Director("张无忌");
        gyang = new VicePresident("杨过");
        jguo = new President("郭靖");
        meeting = new Congress("董事会");

        // 创建职责链
        wjzhang.setSuccessor(gyang);
        gyang.setSuccessor(jguo);
        jguo.setSuccessor(meeting);

        // 创建采购单
        PurchaseRequest pr1 = new PurchaseRequest(45000, 1001, "购买倚天剑");
        wjzhang.processRequest(pr1);

        PurchaseRequest pr2 = new PurchaseRequest(60000, 1002, "购买《葵花宝典》");
        wjzhang.processRequest(pr2);

        PurchaseRequest pr3 = new PurchaseRequest(160000, 1003, "购买《金刚经》");
        wjzhang.processRequest(pr3);

        PurchaseRequest pr4 = new PurchaseRequest(800000, 1004, "购买桃花岛");
        wjzhang.processRequest(pr4);
    }
}
